//
//  Vacation.m
//  Vacations
//
//  Created by User-23 on 10/31/14.
//  Copyright (c) 2014 TrainingCamp. All rights reserved.
//

#import "Vacation.h"
#import "VacationBook.h"

@interface Vacation ()

@property (readwrite) NSString* name;
@property (readwrite) NSString* info;
@property (readwrite) NSString* location;
@property (readwrite) NSArray* openDays;
@property (nonatomic, readwrite) NSNumber* price;
@property NSInteger reviewCount;

@property (readwrite) VacationType type;


@end



@implementation Vacation

//static NSInteger reviewCount = 0;

- (instancetype)initWithName:(NSString*) name andWithType:(VacationType) type andWithInfo:(NSString*) info andWithLocation:(NSString*) location andWithOpenDays:(NSArray*) days andWithPrice:(NSNumber*) price
{
    self = [super init];
    if (self) {
        self.name = name;
        self.info = info;
        self.location = location;
        self.price = price;
        self.openDays = days;
        self.type = type;
        self.reviewCount = 0;
        
    }
    NSLog(@"%@ , %d", self.name, self.reviewCount);
    return self;
}

-(void)setPrice:(NSNumber*)price
{
    if (price >= 0) {
        _price = price;
    }
}

// increase price when is back from backgroound
-(void) changePrice
{
    self.price = @([self.price integerValue] + [self.price integerValue] * 0.2);
    NSLog(@"cenata smenena");
}

-(void) increaseReviewCount
{
    self.reviewCount++;
    //NSLog(@"review increase");
    NSLog(@"%@ , %d visit(s)", self.name, self.reviewCount);
}

@end
